package cn.tedu.lbs.stock.web.repository;

import cn.tedu.lbs.stock.web.mapper.StockMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tarena.lbs.pojo.stock.po.CouponStockPO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class StockRepository extends ServiceImpl<StockMapper, CouponStockPO> {
    @Autowired
    private StockMapper stockMapper;
    public boolean reduceStock(Integer couponId, Integer num) {
        int row=stockMapper.reduceStock(couponId,num);
        return row>0;//说明更新 写操作 影响了一行数据
    }
}
